m.dataini = {01-07-2005}
m.datafin = {29-07-2005}

Select * from caixa a, movmento b ;
 where a.numfecha = b.numfecha ;
   and a.numfecha != space(8) ;
   and a.Data between m.DataIni and m.DataFin ;
   and b.Tipo in ( [R], [S] ) ;
 order by a.data, a.numfecha, b.data, b.hora ;
  into cursor cMovCaixa1


Select * from caixa a, movmento b ;
 where a.numfecha = b.numfecha ;
   and a.paciente = b.paciente ;
   and a.numfecha != space(8) ;
   and a.Data between m.DataIni and m.DataFin ;
   and b.Tipo in ( [R], [S] ) ;
 order by a.data, a.numfecha, b.data, b.hora ;
  into cursor cMovCaixa2
